<?php
class SystemCommonAction extends Action {
	public function admin_priv($priv_str, $msg_type = '' , $msg_output = true) {
		if (Session::getLocal('action_list') == 'all') {
			return true;
		}
		
		if (strpos(',' . Session::getLocal('action_list') . ',', ',' . $priv_str . ',') === false) {
			if ($msg_output){
	            $this->error('对不起,您没有执行此项操作的权限!');
	        }
	        return false;
		} else {
			return true;
		}
	}
	
    public function checkMember($type = 1) {
    	
        if (Session::getLocal('s_admin') !== 1 && $type == 1) {
//            $this->assign('jumpUrl',__APP__.'/Index/login');
//            $this->error('尚未登录,请先登录.');
//			echo '<script type=\'text/javascript\'>window.parent.location.href=\'' . __APP__ . '/Admin/Index/login\'</script>';
			redirect(__APP__.'/Admin/Index/login');
        }
    }	
    
    public function logOut() {
        Session::clearLocal();
//      echo '<script type=\'text/javascript\'>window.parent.location.href=\'./Index/login\'</script>';
		redirect(__APP__.'/Admin/Index/login');
    }
    
    public function msg($str){
        echo "<script>alert('{$str}');window.history.go(-1);</script>";
    }
}
?>